import request from "@/utils/request";
import { parseStrEmpty } from "@/utils/ruoyi";

//
export const signintaskService = {


    list(query) {
        return request({
            url: "/api/signintask/list",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/signintask/save-or-update`,
            method: "post",
            data,
        });
    },

};

//
export const courseService = {


    list(query) {
        return request({
            url: "/api/course/list",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/course/save-or-update`,
            method: "post",
            data,
        });
    },

};

//
export const teacherService = {


    list(query) {
        return request({
            url: "/api/teacher/list",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/teacher/save-or-update`,
            method: "post",
            data,
        });
    },
    postSavePhoto(data) {
        return request({
            url: `/api/teacher/save-photo/${data.objId}/${data.attachmentId}`,
            method: "post",
            data,
        });
    },
};

//
export const roomrequestService = {
    mylist(query) {
        return request({
            url: "/api/roomrequest/my-list",
            method: "get",
            params: query,
        });
    },
    list(query) {
        return request({
            url: "/api/roomrequest/list",
            method: "get",
            params: query,
        });
    },

    postApply(data) {
        return request({
            url: `/api/roomrequest/student/apply`,
            method: "post",
            data,
        });
    },
    postAgree(params) {
        return request({
            url: `/api/roomrequest/admin/audit/${params.id}`,
            method: "post",
            params: { auditState: 'agree' }
        });
    },
    postRefuse(params) {
        return request({
            url: `/api/roomrequest/admin/audit/${params.id}`,
            method: "post",
            params: { auditState: 'refuse' }
        });
    },

    postCancel(params) {
        return request({
            url: `/api/roomrequest/student/cancel/${params.id}`,
            method: "post",
            params,
        });
    },
};
//
export const roomassignService = {
    list(query) {
        return request({
            url: "/api/roomassign/list",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/roomassign/save-or-update`,
            method: "post",
            data,
        });
    },

    postDel(params) {
        return request({
            url: `/api/roomassign/d`,
            method: "post",
            params,
        });
    },
};
//
export const roomcateService = {
    list(query) {
        return request({
            url: "/api/roomcate/list",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/roomcate/save-or-update`,
            method: "post",
            data,
        });
    },
};
//
export const roomService = {
    list(query) {
        return request({
            url: "/api/room/list",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/room/save-or-update`,
            method: "post",
            data,
        });
    },
};
//
export const studentService = {

    getDormList(query) {
        return request({
            url: `/api/student/dorm-list/${query.studentId}`,
            method: "get",
            params: query,
        });
    },
    list(query) {
        return request({
            url: "/api/student/list",
            method: "get",
            params: query,
        });
    },
    listDynamic(query) {
        return request({
            url: "/api/student/list-dynamic",
            method: "get",
            params: query,
        });
    },

    postSave(data) {
        return request({
            url: `/api/student/save-or-update`,
            method: "post",
            data,
        });
    },
};
